
import { generateColors } from '@/utils/theme'
import { getItem } from '@/utils/storage'
import {MAIN_COLOR} from '@/constant/index'
const getters = {
  // 获取登录的token
  token : state => state.user.token,
  // 判断是否登录了的个人信息
  hasUserInfo : state =>{
    return JSON.stringify(state.user.userInfo) != '{}'
  },
  // 获取用户信息
  userInfo : state=>state.user.userInfo,
  cssVar: state => ({
    ...state.theme.variables,  
    ...generateColors(getItem(MAIN_COLOR))
  }),
  sidebarOpened: state => state.app.sidebarOpened,
  language: state => state.app.language,
  mainColor:state =>state.theme.mainColor,
  tagsViewList:state =>state.app.tagsViewList
}

export default getters